import java.util.*;

// 按两次 Shift 打开“随处搜索”对话框并输入 `show whitespaces`，
// 然后按 Enter 键。现在，您可以在代码中看到空格字符。
public class Main {
    public static void main(String[] args) {


        Scanner scanner = new Scanner(System.in);
        String next = scanner.next();
        System.out.println("1: "+next);
        next = scanner.nextLine();
        System.out.println("2: "+next);
        int num = scanner.nextInt();
        System.out.println("3: "+num);

        System.out.printf("%d %o %x ", 15, 15, 15);
        System.out.printf("%d %o %x ", Integer.parseInt("15"), 15, 15);
        num = Integer.parseInt("15");
        List<Integer> list = new LinkedList<>();
        List<Integer> list2 = new ArrayList<>();
        list.add(1);                      //在尾部添加元素
        list.add(0, 2);      //插入到指定位置
        list.remove(1);             //删除制定下标元素
        boolean b = list.contains(1);     //是否包含某元素
        Integer integer = list.get(0);    //获取指定下标元素
        int size = list.size();           //列表大小
        list.sort((o1, o2) -> o1 - o2);     //使用lambda表达式排序
        System.out.println("                ");

        String str = "fwefawf";
        String s2;
        char c = str.charAt(2);
        int length = str.length();
        int i = str.lastIndexOf("f");                 //从后向前找第一个
        int i2 = str.lastIndexOf("f", 3);   //从下标3开始向前找第一个（包含3）
        int i3 = str.indexOf("f");                        //从前向后找第一个
        int i4 = str.indexOf("f", 3);       //从下标3开始向后找第一个（包含3）
        String s3 = str.substring(1, 3);                  //从下标1到3，包含1、不包含3
        String s4 = str.substring(1);           //从下标1到结束，包含1
        String s5 = str.replace("f", "w");  //替换
        System.out.println(s3);
        System.out.println(s4);
        System.out.println(s5);
        System.out.printf("%d %d %d %d", i, i2, i3, i4);

        int[] x = new int[5];
        int[] x2 = new int[]{1,2,3,4};
        int length2 = x.length;
        for (int x1 : x) {
            System.out.println(x1);
        }
        Arrays.sort(x);

        Map<String,String> map = new HashMap<>();
        map.put("123","dw");
        map.get("123");
        map.remove("123");
        map.size();
        map.containsKey("123");
        Set<String> strings = map.keySet();
        map.isEmpty();

        Set<String> set = new HashSet<>();
        set.add("2432");
        set.size();
        set.contains("32");
        set.isEmpty();
        set.remove("23");
        for (String s : set) {
            System.out.println(s);
        }

        Stack<Integer> stack = new Stack<>();
        stack.push(21);         //入栈
        stack.push(21);         //入栈
        Integer pop = stack.pop();    //出栈，空栈会报错
        stack.isEmpty();
        stack.peek();   //查看栈顶元素值，空栈会报错
        stack.size();

        Queue<Integer> queue = new LinkedList<>();
        queue.add(12);          //入队
        queue.add(12);          //入队
        Integer poll = queue.poll();    //出队，队空则为null
        queue.size();
        queue.isEmpty();
        queue.peek();   //查看队首，若为空，则返回null


        PriorityQueue<Integer> heap = new PriorityQueue<>();    //小根堆
        PriorityQueue<Integer> heap2 = new PriorityQueue<>((o1, o2) -> o2-o1);  //大根堆
        heap.add(1);
        heap.add(1);
        heap.poll();
        heap.peek();    //查看堆顶，若为空，则返回null
        heap.isEmpty();
        heap.size();

        System.out.printf("%3d\n",1);
        System.out.printf("%-3d%d\n",1,2);
        System.out.printf("%-5.2f%d\n",1.00012,2);
        System.out.printf("%-5.2s%d\n","1.00012",2);
        System.out.println("hello world");




    }

    class car{
        String name;
        public car(String name) {
            this.name = name;
        }
        private void setName(){

        }
    }
}